<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>03-flex设置主轴上的子元素排列方式</title>
  <style>
    div {
      /* 1. 给父级添加flex布局属性才能够控制子元素哦 */
      display: flex;

      /* 2. 设置主轴方向，设置完后子元素就是沿着y轴进行排列 */
      flex-direction: row;
      /* 修改主轴: 设置flex布局一定注意flex布局的主轴方向因为子元素都是排列在主轴上的 */
      flex-direction: column;

      /* 3. 设置主轴上子元素的排列方式: 排列顺序不变 */
      /* flex-start: 默认从左到右排列 */
      justify-content: flex-start;

      /* flex-end: 从尾部开始排列 */
      justify-content: flex-end;

      /* space-around: 盒子均等分配 */
      justify-content: space-around;

      /* space-between: 将两侧贴边 后均等分(重要) */
      justify-content: space-between;

      /* center: 居中对齐 */
      justify-content: center;

      width: 800px;
      height: 500px;
      margin: 0 auto;
      background-color: pink;
    }

    div span {
      width: 150px;
      height: 100px;
      background: skyblue;
    }
  </style>
</head>

<body>

  <div>
    <span>1</span>
    <span>2</span>
    <span>3</span>
    <span>4</span>
  </div>

</body>

</html>